<script type="text/javascript" src="__STATIC__mobile/js/swipe.js"></script>

<script>
    var IsShop="";//是否是首页

    $(function(){

                
        $(document).on('touchend',"#mmexport",function(){
            $(this).hide();
        });
        $(document).on('touchend',"#mmexport-pl",function(){
            $(this).hide();
        });
        $(document).on('touchend',"#mmexport-share",function(){
            $(this).hide();
        });



                        (function(){
            // 控制添加商品的图片显示高度，确保商品布局正常
            $('.b_mingoods,.mingoods').each(function(index, el) {
                var me = $(this),
                    imgHeight = me.find('img').width();
                me.find('img').closest('a').height(imgHeight);
            });
            $('.board3').each(function(index, el) {
                var me = $(this);
                var bwidth = me.width();
                if(me.hasClass('small_board') || !me.hasClass('big_board')){
                    me.children('span').attr('style', 'height:'+bwidth+'px !important;overflow:hidden;');
                }
                if(me.hasClass('big_board')){
                    me.children('span').attr('style', 'height:'+(bwidth*2+10)+'px !important;overflow:hidden;');
                }
            });

            // 悬浮按钮
            var SpsBtn = {
                config:{
                    menu:document.getElementById('menufloat'),
                    menusub:document.getElementById('menufloat-c'),
                    menubtn:document.getElementById('menubtn')
                },
                init:function(){
                    this.SpsbtnClick();
                    this.touchMove();
                },
                touchMove:function(){
                    var _this = this;
                    _this.config.menu.addEventListener('touchmove',function(e){
                        e.preventDefault();
                        var touch = e.touches[0],
                            moveX,moveY,
                            winWh = window.innerWidth - 50,
                            winHt = window.innerHeight - 50;
                        moveX = touch.clientX -25;
                        moveY = touch.clientY -25;
                        moveY  = moveY  < 0 ? 0 : moveY ;
                        moveX = moveX < 0 ? 0 : moveX;
                        moveY = moveY > winHt ? winHt : moveY;
                        moveX = moveX > winWh ? winWh :moveX;
                         _this.config.menu.style.left = moveX + 'px';
                         _this.config.menu.style.top = moveY + 'px';
                         _this.config.menusub.style.left = moveX + 10 + 'px';
                         _this.config.menusub.style.top = moveY -190 + 'px';
                    },false)
                    
                    
                },
                SpsbtnClick:function(){
                    var _this = this;
                    this.config.menu.addEventListener('click',function(){
                        var me = $(this);
                        // console.log(me)
                        if(!me.hasClass('show')){
                            me.addClass('show');
                            me.siblings('.mask_menu,#menufloat-c').show();
                            me.siblings('#menufloat-c').find('.menu-c-inner').addClass('in').removeClass('outer')
                        }else{
                            me.removeClass('show');
                            me.siblings('.mask_menu,#menufloat-c').hide();
                            me.siblings('#menufloat-c').find('.menu-c-inner').removeClass('in').addClass('outer')
                        }
                    },false);
                    this.config.menubtn.addEventListener('click',function(){
                        $(_this.config.menu).removeClass('show');
                        $(_this.config.menu).siblings('.mask_menu,#menufloat-c').hide();
                        $(_this.config.menu).siblings('#menufloat-c').find('.menu-c-inner').removeClass('in').addClass('outer')
                    })
                }
            }
            SpsBtn.init();            // 收藏按钮
            $('#collect-link').click(function(event) {
                $('.menu').removeClass('show');
                $('.mask_menu').hide();
                $('.menu-c-inner').removeClass('in').addClass('outer')
                $('.collectbg').show();
            });
            $('.a-know').click(function(event) {
                $(this).parent('.collectbg,.sharebg').hide();
            });
            // 分享
            $('#share-link').click(function(event) {
                return false;
                $('.menu').removeClass('show');
                $('.mask_menu').hide();
                $('.menu-c-inner').removeClass('in').addClass('outer')
                $('.sharebg').show();
            });
            
            $('.share-link').click(function(event) {
                return false;
                $('.menu').removeClass('show');
                $('.mask_menu').hide();
                $('.menu-c-inner').removeClass('in').addClass('outer')
                $('.sharebg').show();
            }); 
            
            
        })();


	// 购物车数据
/*
	var carturl = "#";
	$.post("/Shop/getCartNum",{},function(data) {
		var html = '<a href="'+carturl+'" class="navCart" id="navCart"><span>'+ data.num + '</span></a>';
		$("#htmlReplace-navCart").replaceWith(html);
			if (data.num > 0) {
				$("#navCart").show();
				} else {
					$("#navCart").hide();
		}
}, "json");
	*/
	
	
	
	
});

	</script>
	
	
<script>
//image lazyload
$(function(){
    $("img.lazyload").lazyload({
        threshold:650
    });
});
</script>